import Vue from 'vue'
import VueRouter from 'vue-router'

// 路由数据
import aHome from './a-home'

Vue.use(VueRouter)

const router = new VueRouter(aHome)

/**
 * 路由钩子
 **/
router.beforeEach((to, from, next) => {
    console.log(to.name)
    window.document.title = to.name //当前路由名换成title
    next()
})

router.afterEach((to, from) => {
    window.scrollTo(0, 0) // 离开的时候回到顶部
})


export default router